package com.shouhe.mysap.util;

import com.baomidou.mybatisplus.extension.service.IService;
import com.shouhe.mysap.common.MySapResult;

import java.util.List;

/**
 * @author 守鹤
 * @date 2020/6/1 22:35
 */
public class AddUtil {

    public static <T> MySapResult addObject(String oper,T object, IService<T> service){
        boolean save = service.save(object);
        return PrintUtil.succOrErr(save,oper,object.toString());
    }

    public static <T> MySapResult addObjectList(String oper, List<T> list, IService<T> service){
        boolean save = service.saveBatch(list);
        return PrintUtil.succOrErr(save,oper,list.toString());
    }
}
